home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 September (IDG) / Sep99.iso / Shareware World / Comms & Internet / LinkConverter 1.1.2 / Dialog Director v0.7 / Examples / Kibbles.as < prev    next >
Encoding:
Text File  |  1998-01-12  |  2.2 KB  |  54 lines  |  [TEXT/ToyS]

  1. dd install with fonts [null, null, null, null, {name:"Geneva", size:10}] with grayscale
  2. if Alert(0, "Check this computer for available kibbles?", ¬
  3.     "Checking for kibbles is an demonstration task that will take" & ¬
  4.     " a few seconds but may be stopped safely at anytime.", "OK", "Cancel") then
  5.     
  6.     set progress to dd make dialog {size:[320, 92], default item:2, contents:[¬
  7.         {class:push button, bounds:[242, 63, 310, 83], name:"Stop -."}, ¬
  8.         {class:static text, bounds:[10, 9, 352, 9 + 16], contents:"Looking for kibble boxes:"}, ¬
  9.         {class:gauge, bounds:[10, 35, 310, 35 + 12], max value:-1} ¬
  10.             ], style:movable dialog, name:"Kibbles"}
  11.     set aborted to false
  12.     repeat with i from 1 to 50
  13.         if (dd interact with user for max ticks 0) = 1 then
  14.             set aborted to true
  15.             exit repeat
  16.         end if
  17.         dd set value of item 3 of progress to i
  18.     end repeat
  19.     if not aborted then
  20.         dd set contents of item 2 of progress to "Checking found boxes for kibbles:"
  21.         dd set value of item 3 of progress to 0
  22.         dd set max value of item 3 of progress to 200
  23.         repeat with i from 1 to 200
  24.             if (dd interact with user for max ticks 0) = 1 then
  25.                 set aborted to true
  26.                 exit repeat
  27.             end if
  28.             dd set value of item 3 of progress to i
  29.         end repeat
  30.     end if
  31.     dd delete progress
  32.     if aborted then
  33.         Alert(2, "You have stopped the kibble check!", ¬
  34.             "Go straight to bed with nothing to eat!", "Oh No!", "")
  35.     else
  36.         Alert(1, "There are no more available kibbles on your computer.", ¬
  37.             "To increase the number of kibbles, find the nearest dog and take" & ¬
  38.             " the necessary number form his food bowl.", "OK", "")
  39.     end if
  40. end if
  41. dd uninstall
  42.  
  43. -- From ‘Alert.as’
  44. on Alert(icn, msg1, msg2, btn1, btn2)
  45.     set c to [{class:push button, bounds:[295, 83, 353, 103], name:btn1}]
  46.     if btn2 ≠ "" then set c to c & [{class:push button, bounds:[225, 83, 283, 103], name:btn2}]
  47.     set dlog to {size:[362, 112], style:movable dialog, contents:c & [¬
  48.         {class:icon, bounds:[17, 9, 17 + 32, 9 + 32], contents:icn}, ¬
  49.         {class:static text, bounds:[67, 9, 352, 9 + 32], contents:msg1}, ¬
  50.         {class:static text, bounds:[67, 45, 352, 45 + 26], contents:msg2, font:5} ¬
  51.             ]}
  52.     
  53.     (dd auto dialog dlog with fonts [null, null, null, null, {name:"Geneva", size:10}] with grayscale)'s item 1
  54. end Alert